<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<MvcCms.Web.ViewModels.BackOfficeModel>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    MvcCms - <%=ViewData["PageTitle"]%>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="HeaderContent" runat="server">
    <style type="text/css">
        .style1
        {
            color: #FF3300;
            font-weight: bold;
            font-size: large;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<div class="contentpage-outerdiv">
    <span class="field-validation-error">&nbsp;<%= Html.ValidationSummary("Edit was unsuccessful. Please correct the errors and try again.") %>
        <%=ViewData["message"].ToString()%>
    </span>
    <%
    using (Html.BeginForm())
    {
    %>
    <fieldset>
        <legend>Edit Content Category</legend>
        <div class="left">
            <table width="100%">
                <tr>
                    <td width="70%">
                        <p>
                            <label for="Title">Title:</label>
                            <%=Html.TextBox("Title", Model._ContentCategory.Title)%>
                        </p>
                        <p>
                            <label for="Description">Description:</label>
                            <%=Html.TextArea("Description", Model._ContentCategory.Description)%>
                        </p>
                        <p>
                            <label for="SubPageHeader">Sub-Page Header:</label>
                            <%=Html.TextArea("SubPageHeader", Model._ContentCategory.SubPageHeader)%>
                        </p>
                        <p>
                            <label for="ExternalURL">External URL: (If entered link will go to url entered.)</label>
                            <%=Html.TextBox("ExternalURL", Model._ContentCategory.ExternalURL)%>              
                        </p>
                    </td>
                    <td valign="top">
                        <%=ViewData["prntcatmsg"]%><br />
                        <%=Html.CheckBox("issubcategory", bool.Parse(ViewData["issubcat"].ToString()), new { onclick = "SetShowInNav()" })%>
                        <p>
                            <label for="Category">
                                Subcategory Of:</label>                                
                            <%=Html.DropDownList("CategoryID")%>
                        </p> 
                        <p>
                            <label for="ThemeName">Theme Name: (If entered the portal theme will be overridden.)</label>
                            <%=Html.TextBox("ThemeName", Model._ContentCategory.ThemeName)%>              
                        </p>   
                        <p>
                            <label for="MasterName">Master Name: (If entered the default master name will be overridden.)</label>
                            <%=Html.TextBox("MasterName", Model._ContentCategory.MasterName)%>              
                        </p>                                                                                 
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <table>
                            <tr class="small">
                                <td>
                                    <label for="ShowInNav">
                                        ShowInNav: (SubCategories are shown in the nav by default)</label>
                                    <%if (bool.Parse(ViewData["issubcat"].ToString()))
                                      {%>
                                    <%= Html.CheckBox("ShowInNav", Model._ContentCategory.ShowInNav, new { disabled = "disabled" })%>
                                    <%}
                                      else
                                      {%>
                                    <%= Html.CheckBox("ShowInNav", Model._ContentCategory.ShowInNav)%>
                                    <%}%>
                                </td>
                                <td>
                                    <label for="OnlyForMembers">
                                        Only For Members:</label>
                                    <%= Html.CheckBox("OnlyForMembers", Model._ContentCategory.OnlyForMembers)%>
                                </td>
                                <td>
                                    <label for="RequireSSL">
                                        Require SSL:</label>
                                    <%= Html.CheckBox("RequireSSL", Model._ContentCategory.RequireSSL)%>
                                </td>
                                <td>
                                    <label for="AreaRoute">
                                       Uses Custom Area Route:</label>
                                        <%= Model._ContentCategory.UsesCustomAreaRoute.ToString()%>
                                </td>                                   
                            </tr>
                            <tr>
                                <td colspan="4">
                                    <label for="OnlyForMembersRoles">Only For Members Roles:</label>
                                    <%=Html.TextBox("OnlyForMembersRoles", Model._ContentCategory.OnlyForMembersRoles)%> (Comma Seperated)
                                </td>
                            </tr>
                        </table>
                        <p>
                            <input type="submit" value="Save" />
                        </p>
                    </td>
                </tr>
            </table>
        </div>
        <div class="right">
            Changing the category name here will change the title in the navigation and the title
            in search results and the browser title bar but it will not change the url created
            for the category. This is done to keep your pages search engine results consistent 
            and to maintin external links.  This also allows sub category names to have the parent category names added manually after the correct url is assembled.<br /><br />
            The current path route value for this category is <span class="field-validation-error"><%=Html.Encode(Model._ContentCategory.Path) %></span> 
        </div>
        <div class="clear">
        </div>
    </fieldset>
    <% } %>
    <div>
        <%=Html.ActionLink("Back to List", "ManageContentCategories") %>
    </div>
</div>     
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="ScriptContent" runat="server">
    <script type="text/javascript">
        function SetShowInNav() {
            var chkShowInNav = $("#ShowInNav:checked").val();
            var chkissubcategory = $("#issubcategory:checked").val();
            if (chkissubcategory == 'true') {
                $("#ShowInNav:checked").click();
                $("#ShowInNav").attr('disabled', true);
            }
            if (chkissubcategory != 'true') {
                $("#ShowInNav").attr('disabled', false);
            }
        }
        
        
        <%
        if (Model._ContentCategory.ParentCategory!=null || Model._ContentCategory.SubCategories.Count()>0){ %>
            
            $("#CategoryID").attr('disabled', true);
            $("#issubcategory").attr('disabled', true);
        <%} %>
        
    </script>
</asp:Content>
